home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The X-Philes (2nd Revision)
/
The X-Philes Number 1 (1995).iso
/
xphiles
/
hp48_1
/
phone
< prev
next >
Wrap
Text File
|
1995-03-31
|
6KB
|
293 lines
Article 6316 of comp.sys.handhelds:
Path: en.ecn.purdue.edu!noose.ecn.purdue.edu!samsung!uunet!stanford.edu!agate!usenet.ins.cwru.edu!po.CWRU.Edu!rkb
From: rkb@po.CWRU.Edu (Robert K. Brunner)
Newsgroups: comp.sys.handhelds
Subject: HP48 phonebook/list program
Message-ID: <1991Apr29.195912.3050@usenet.ins.cwru.edu>
Date: 29 Apr 91 19:59:12 GMT
Sender: news@usenet.ins.cwru.edu
Reply-To: brunner@uirvld.csl.uiuc.edu (Robert K. Brunner)
Organization: Case Western Reserve University, Cleveland, Ohio, (USA)
Lines: 278
Nntp-Posting-Host: cwns5.ins.cwru.edu
Hello.
For some time I have been looking for a little list manager program
to let me store phone numbers or lists on my HP48. With no memory cards,
I was looking for something small. I couldn't find any I liked, so
I wrote my own. The program is based on an index-card metaphor.
Cards are indexed by their first line. To save memory, I made extensive
use of the INPUT command rather than writing my own editor. The whole
program is only 2300 bytes (without data)
Operation:
Download the directory to the 48. Go into the directory and then into
the FILES subdirectory. Enter a quoted variable name for the database
and press CARDS.
If the database does not exist, a null list will be created and stored
in the variable. Then the card viewer will start. The following commands
work in the viewer:
Up arrow - Scroll current card up.
Down arrow - Scroll current card down.
Left arrow - Move to previous card.
Right arrow - Move to next card.
ADD - Add a new card. Initially the database is empty, so this
will be the only valid option.
EDIT - Edit the contents of the current card. The title line cannot
be changed. To change the title, delete the card with DEL
and retype it using ADD.
DEL - Delete current card.
FIND - Search cards for a matching (or closest) title. FIND prompts
the user for the search text.
SAVE - Save the database back to the variable name. The program
works on a copy of the database, so if you make a mistake,
you can just QUIT without changing the database
QUIT - Quit the card viewer. The current database is not saved,
so SAVE should be done before QUIT to keep any changes.
Let me know if you use this program. There are lots of ways it
can be extended, but life is short and SRAM expensive. The error
checking is nonexistent, which is why I make the user execute SAVE
explicitly so the database does not become corrupted if something
strange happens.
Robert Brunner
brunner@uirvld.csl.uiuc.edu
Here is the program:
----------
%%HP: T(3)A(D)F(.);
DIR
FILES
DIR
CARDS
\<< RCWS 64
STWS RCLF ROT
IF DUP
VTYPE -1 ==
THEN DUP
{ } SWAP STO
END CVIEW
STOF STWS
\>>
END
CVIEW
\<< DUP RCL DUP
SIZE ROT 1 DUP DUP
0 DUP DUP DUP \->
imax fnm i jmax j
ti tx txi txl
\<< { "ADD"
"EDIT" "DEL" "FIND"
"SAVE" "QUIT" }
TMENU 11 SF 10 CF
DO
IF imax
THEN
IF 11
FS?C
THEN
CLLCD DUP i cGET
'jmax' STO 'txl'
STO 'txi' STO 'tx'
STO DUP 1 DISP 'ti'
STO
END tx
txi j txl ROT ROT
GET SWAP SUB 2 DISP
ELSE
CLLCD "Empty file"
2 DISP 11 CF 0
'jmax' STO
END -1
WAIT
CASE DUP
25.1 ==
THEN
IF j
1 >
THEN
'j' DECR DROP
ELSE
eBEEP
END
END DUP
35.1 ==
THEN
IF j
5 + jmax <
THEN
'j' INCR DROP
ELSE
eBEEP
END
END DUP
34.1 ==
THEN
IF i
1 >
THEN
1 'j' STO 'i' DECR
DROP 11 SF
ELSE
eBEEP
END
END DUP
36.1 ==
THEN
IF i
imax <
THEN
1 'j' STO 'i' INCR
DROP 11 SF
ELSE
eBEEP
END
END DUP
11.1 ==
THEN
DROP icADD 'i' STO
11 SF 'imax' INCR
END DUP
12.1 ==
THEN
IF
imax
THEN
DROP i icED 11 SF 0
ELSE
eBEEP
END
END DUP
13.1 ==
THEN
IF
imax
THEN
DROP i cDEL 1 'j'
STO 'imax' DECR
IF i <
THEN 'i' DECR
ELSE 0
END 11 SF
ELSE
eBEEP
END
END DUP
14.1 ==
THEN
IF
imax
THEN
DROP DUP "Title:" {
\Ga } INPUT cFIND
IF DUP imax <
THEN 1 +
END 'i' STO 11 SF 0
ELSE
eBEEP
END
END DUP
15.1 ==
THEN
DROP DUP fnm STO 0
END DUP
16.1 ==
THEN 10
SF
END
END DROP
UNTIL 10
FS?
END DROP 0
MENU
\>>
\>>
icADD
\<< DUP SIZE
"Title:" { \Ga }
INPUT DUP ":" + { \Ga
} INPUT \-> tit tx
\<<
IF NOT
THEN 0
ELSE DUP
tit cFIND
END SWAP
OVER tit tx 2 \->LIST
cADD SWAP 1 +
\>>
\>>
icED
\<< \-> i
\<< DUP i GET
DUP OBJ\-> DROP SWAP
":" + SWAP { \Ga } +
INPUT 2 SWAP PUT i
SWAP PUT
\>>
\>>
eBEEP
\<< 440 .1 BEEP
\>>
cGET
\<< GET OBJ\-> DROP
SWAP ":" + SWAP DUP
DUP SIZE { 1 } \-> sz
txi
\<<
WHILE DUP
"
" POS DUP
REPEAT SWAP
OVER " " REPL SWAP
1 + 'txi' SWAP STO+
END DROP2
txi sz OVER SIZE
\>>
\>>
cADD
\<< \-> i new
\<< OBJ\-> \-> n
\<< new 'n'
INCR i - ROLLD n
\->LIST
\>>
\>>
\>>
cFIND
\<< \-> str
\<< { "" } SWAP
OBJ\-> DUP \-> n i
\<<
IF n
THEN
WHILE 1
GET str \>= i AND
REPEAT
'i' DECR DROP
END
END i
DROPN i
\>>
\>>
\>>
cDEL
\<< \-> i
\<< OBJ\-> \-> n
\<< n i - 1 +
ROLL DROP n 1 -
\->LIST
\>>
\>>
\>>
END
---------